<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
    String actionURL = path + "/cms/consumables/doQuery.do";
%>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href="<%=basePath%>">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<title>涵春楼服务应用管理平台</title>
<link href="css/css-main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/msgbox/jquery.msgbox.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/msgbox/jquery.dragndrop.min.js"></script>
<script type="text/javascript" src="js/msgbox/msgbox.js"></script>
<script type="text/javascript" src="js/zDialog/zDialog.js"></script>
<script type="text/javascript" src="js/zDialog/zDrag.js"></script>
<script type="text/javascript" src="js/common.js"></script>

<script type="text/javascript">
function selectAll(fromName, boxname) {
	var f = document.forms[fromName];
	for ( var i = 0; i <= f.elements.length; i++) {
		if (f.elements[i].name == boxname) {
			f.elements[i].checked = !f.elements[i].checked;
		}
	}
}
/*
复选框删除功能 可以传递自定义描述
*  
*/
function confirmDel(doc)
{    
    var delNum = 0;
    var innerIndexs = doc.getElementsByName("innerIndexs");
   
    for(var i=0;i<innerIndexs.length;i++)
    {
           if(innerIndexs[i].checked)
           {
               delNum++;
           }
    }
     if(delNum <= 0)
    {    
        alert("请至少选择一条待删除记录");    
        return false;
    }
    var desc = "你确定要删除"+ delNum +"条记录吗？\n记录删除后将无法恢复！"; 
  
    if(window.confirm(desc))
    {
       document.form_del.submit();
       return true;
    }
    else
    {
      return false;
    }
}
</script>
</head>
<body>
<div class="main-con">
		<!--//导航位置层-->
		<div class="main-bar">
			<span class="bar-position">当前位置：<a href="#">易耗品管理</a>
				&gt;&gt; 库存管理</span>
		</div>
		<div class="cont_right_cont">
			<div>
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td>
					     <input name="button5" type="submit" class="btn-Yes" id="AddBtn" value="入库" onclick="$.toAddDiag(610,290,'易耗品入库','toImport.do')">
					     <input name="button5" type="submit" class="btn-Yes" id="AddBtn" value="增加" onclick="$.toModDiag(600,335,'新增易耗品信息','toAdd.do')">
						 <input name="button2" type="submit" class="btn-Yes" id="DelBtn" value="删除" onclick="confirmDel(document);">
						</td>
						<td width="150" height="40" align="right" valign="middle">
						<select class="data-searchtxt-select" id="queryConditon_key"
							style="width:150px">
								<option value="consumablesName">易耗品名称</option>
								<!--  <option value="consumablesTypeInfo.consumablesTypeName">易耗品类别</option> -->
								<option value="consumablesBrand">易耗品品牌</option>
						</select>
						</td>
						<td width="150" align="right" valign="middle">
						 <span style="padding:0px"> 
						  <input type="text" class="data-searchtxt-runtime" id="queryConditon_value"/>
						 </span>
						</td>
						<td width="100" align="right" valign="middle">
						<input name="queryBtn" type="button" class="data-searchbtn" id="queryBtn" value="查 询" onclick="do_search(1);"  />
						</td>
					</tr>
				</table>
			</div>
				<form name="form_del" id="form_del" target="hid"
					action="cms/consumables/doDel.do">
					<table width="100%" border="0" cellspacing="0" cellpadding="0"
						class="datalist">
						<tr>
							<th width="4%"><input type="checkbox" name="checkbox"
								id="checkbox" onclick="selectAll('form_del','innerIndexs');">
							</th>
							<th nowrap>序号</th>
							<th nowrap>易耗品名称</th>
							<th nowrap>易耗品类别</th>
							<th nowrap>易耗品品牌</th>
							<th nowrap>供应商</th>
							<th nowrap>数量</th>
							<th nowrap>预警</th>
							<th nowrap>备注</th>
							<th nowrap>操作</th>
						</tr>
						<!-- 记录为空 -->
						<s:if test=" results.size == 0">
						</s:if>
						<!-- 存在记录 -->
						<s:if test=" results.size > 0">
							<!--显示List记录！-->
							<s:iterator value="results" status="s">
								<tr>
									<td><input type="checkbox" name="innerIndexs"
										id="innerIndexs"
										value='<s:property value="results[#s.index].consumablesId"/>'>
									</td>
									<td><s:property value="#s.index+1" />
									</td>
									<td><s:property value="results[#s.index].consumablesName" />
									</td>
									<td><s:property
											value="results[#s.index].consumablesTypeInfo.consumablesTypeName" />
									</td>
									<td><s:property value="results[#s.index].consumablesBrand" />
									</td>
									<td><a href="javascript:void(0);"><s:property
											value="results[#s.index].supplierInfo.supplierName" /></a>
									</td>
									<td><s:property
											value="results[#s.index].consumablesQuantity" />
									</td>
									<td nowrap>
										<s:if test='results[#s.index].consumablesQuantity == null'></s:if>
										<s:elseif test="results[#s.index].consumablesQuantity < results[#s.index].alarmQuantity">
											<a href="javascript:void(0);" class="ico_stock">库存不足</a>
										</s:elseif>
										<s:else>
											<a href="javascript:void(0);">充足</a>
										</s:else>
									</td>
									<td><s:property
											value=""/>
									</td>
									<td nowrap width="20%">
										<a href="javascript:void(0);" class="ico_edit"
											onclick="$.toModDiag(500,388,'修改易耗品信息','toMod.do?innerIndex=<s:property value="results[#s.index].consumablesId"/>')">修改</a>
											&nbsp;&nbsp;&nbsp;&nbsp;
										<a href="cms/consumables/toDetail.do?innerIndex=<s:property value="results[#s.index].consumablesId"/>" class="ico_edit" target="mainFrame"
											>明细</a>
											&nbsp;&nbsp;&nbsp;&nbsp;
										<a href="javascript:void(0);" class="ico_edit"
											onclick="$.toModDiag(600,600,'易耗品出库','toExport.do?innerIndex=<s:property value="results[#s.index].consumablesId"/>')">出库</a>
									</td>
								</tr>
							</s:iterator>
						</s:if>
					</table>
				</form>
				
				<form name="pages" method="post" >
					<!--隐藏域 Start -->
					<!-- 引入分页和排序 -->
					<div style="display:none ">
						<input id="curPage" type="hidden" name="page.curPage" value="<s:property value='page.curPage'/>"> 
						<input id="numPerPage" type="hidden" name="page.numPerPage" value="<s:property value='page.numPerPage'/>">
                        <input type="hidden" id="queryConditon_key_hidden" name="queryConditon.key" value="<s:property value='queryConditon.key'/>" > 
                        <input id="queryConditon_value_hidden" type="hidden" name="queryConditon.value" value="<s:property value='queryConditon.value'/>">
                        <iframe name="hid" id="hid" src="" height="0px"></iframe>
					</div>
					<!--隐藏域 End-->
				<div <s:if test=" results.size == 0">style="display:none "</s:if>>
					<%@include file="/jsp/cms/common/page.txt"%>
				</div>
				</form>
		</div>
	</div>
</body>
</html>
